<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9;IE=10;IE=11">
<title>客户触点管理系统</title>
<link rel="stylesheet" href="css/login.css" type="text/css">
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/CryptoJS v3.1.2/rollups/aes.js"></script>
<script src="js/CryptoJS v3.1.2/components/mode-ecb.js"></script>
<script src="js/CryptoJS v3.1.2/components/pad-nopadding-min.js"></script>
<script src="js/crypto/logincry.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#userCode").val("");
		if ($.cookie("rembername") == "true") {
			$("#RememberMe").prop("checked", true);
			$("#userCode").val($.cookie("userName"));
		}
	});

	function loginform() {

		if (($("#RememberMe").prop("checked") == true)
				|| ($("#RememberMe").prop("checked") == "checked")) {
			var userName = $("#userCode").val();
			$.cookie("rembername", "true", {
				expires : 7
			}); // 存储一个带7天期限的 cookie 是否已经选择记录用户名
			$.cookie("userName", userName, {
				expires : 7
			}); // 存储一个带7天期限的 cookie
		} else {
			$.cookie("rembername", null);// 删除 cookie
			$.cookie("userName", null);
		}
		//     	$("#passwordhid").val(Encrypt($("#password").val()));
		//     	$("#usercodehid").val(Encrypt($("#userCode").val()));
		$("#passwordhid").val($("#password").val());
		$("#usercodehid").val($("#userCode").val());
		$("#loginform").submit();
	}
</script>
</head>
<body class="login" style="">
	<div class="login-logo">
		<img src="${ctx }/img/logo-white.png" alt="logo" style="height:50px;"/>
	</div>

	<div>
		<div class="loginbar-l"></div>
		<div class="loginbar-r"></div>
	</div>
	<div class="logo"></div>
	<!-- END LOGO -->
	<!-- BEGIN LOGIN -->
	<div class="content">


		<!-- BEGIN LOGIN FORM -->
		<form id="loginform" action="login" method="post">
			<div class="loginform">
				<div class="loginform-r" id="loginform">
					<input name="__RequestVerificationToken" type="hidden" value="CyDGz-3aldUkBPhSBmSWbvBlRAv5JCuMLGTOOME9lnvK7hJmyKarPARH63JoV3GyNg01aSD9NTUTxB_bDGCtRHYoJreE-cjpH-dNj1cDEiE1">
					<h3 class="form-title">登录</h3>

					<div class="control-group">
						<!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
						<label class="control-label visible-ie8 visible-ie9">用户名：</label>
						<div class="controls">
							<div class="input-icon left">
								<i class="icon-user"></i> <input autocomplete="off" class="m-wrap placeholder-no-fix" id="userCode" name="" placeholder="用户名" type="text" value=""> <input type="hidden" id="usercodehid" name="userCode" value="" />
							</div>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label visible-ie8 visible-ie9">密码：</label>
						<div class="controls">
							<div class="input-icon left">
								<i class="icon-lock"></i> <input autocomplete="off" class="m-wrap placeholder-no-fix" id="password" name="" placeholder="密码" type="password"> <input type="hidden" id="passwordhid" name="password" value="" />
							</div>
						</div>
					</div>
					<div class="form-actions">
						<label class="checkbox">
							<div class="checker" id="uniform-RememberMe">
								<span><input id="RememberMe" name="RememberMe" type="checkbox" value="true"></span>
							</div>
							<input name="RememberMe" type="hidden" value="false">记住用户名
						</label>
						<button type="submit" class="btn green pull-right" onclick='loginform()'>
							登录 <i class="m-icon-swapright m-icon-white"></i>
						</button>
					</div>
					<div class="forget-password">
						<p>
							<a href="javascript:;" id="forget-password">忘记密码？</a>
						</p>
					</div>

					<input id="ReturnUrl" name="ReturnUrl" type="hidden" value="">
				</div>
				<div id="forgetform" class="loginform-r" style="display: none;">
					<!-- BEGIN FORGOT FORM -->
					<h3>忘记密码了？</h3>
					<p>请通过输入你的账号，及账号注册时填写的邮件地址重置密码。</p>
					<div class="validation-summary-errors" id="validateMessage" style="display: none;">
						<ul>
							<li>请输入正确格式的Email</li>
						</ul>
					</div>
					<div class="control-group">
						<!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
						<label class="control-label visible-ie8 visible-ie9">用户名：</label>
						<div class="controls">
							<div class="input-icon left">
								<i class="icon-user"></i> <input class="m-wrap placeholder-no-fix" type="text" id="ResetPWDUserName" placeholder="用户名" autocomplete="off" name="ResetPWDUserName">
							</div>
						</div>
					</div>
					<div class="control-group">
						<div class="controls">
							<div class="input-icon left">
								<i class="icon-envelope"></i> <input class="m-wrap placeholder-no-fix" type="text" id="email" placeholder="Email" autocomplete="off" name="email">
							</div>
						</div>
					</div>
					<div class="form-actions">
						<button type="button" id="back-btn" class="btn">
							<i class="m-icon-swapleft"></i>返回
						</button>
						<button type="button" class="btn green pull-right" id="save" onclick="validateEmail()">
							提交 <i class="m-icon-swapright m-icon-white"></i>
						</button>
					</div>
					<!-- END FORGOT FORM -->
				</div>
			</div>
		</form>
		<!-- END LOGIN FORM -->

	</div>
	<!-- END LOGIN -->
	<!-- BEGIN COPYRIGHT -->
	<div class="loginfooter">
		<div class="copy">©2014,2015 实地地产 版权所有</div>
	</div>
	<div class="browers" style="display: none;">
		请使用 IE9+ , Chrome35.0+ , FireFox 等版本比较新的浏览器浏览。<br>推荐分辨率为：1366 * 768 以上。
	</div>
	<img src="img/login-bg.jpg" id="loginBg" alt="">
	<!-- END COPYRIGHT -->


	<script>
		function validateEmail() {
			var EmailFormat = /^(?:\w+\.?)*\w+@(?:\w+\.)*\w+$/;
			if (!EmailFormat.test($("#email").val())) {
				$("#validateMessage").show();
				$("#email").focus();
				return false;
			}
			$("#validateMessage").hide();
			var model = {};
			model.UserName = $("#ResetPWDUserName").val();
			model.Email = $("#email").val();
			$("#save").attr("disabled", "disabled")
			$.get("/api/SysAccount/ForgetPWD", model, function(result) {
				if (result.IsSussecss) {
					com.message("success", result.Message);
				} else {
					$("#save").removeAttr("disabled");
					com.message("error", result.Message);
				}
			});
		}
		$(document).ready(function() {
			//             App.init();
			//             Login.init();
			//             $('#vcode').on('click', function () {
			//                 var _this = $(this);
			//                 var _url = _this.attr('src');
			//                 if (_url.indexOf('?_') > -1) {
			//                     _url = _url.substring(0, _url.indexOf('?_')) + '?_' + new Date().getTime();
			//                 } else {
			//                     _url += '?_' + new Date().getTime();
			//                 }
			//                 _this.attr('src', _url);
			//             });
			$("#loginform input:eq(1)").focus();//聚焦到用户名
		});
	</script>


</body>
</html>